<?php
	/**
	 * The abstract TableUserStatGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableUserStat subclass which
	 * extends this TableUserStatGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableUserStat class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserId the value for intUserId (Not Null)
	 * @property double $RateAverageAsBuyer the value for fltRateAverageAsBuyer 
	 * @property double $Rate1AverageAsBuyer the value for fltRate1AverageAsBuyer 
	 * @property double $Rate2AverageAsBuyer the value for fltRate2AverageAsBuyer 
	 * @property double $Rate3AverageAsBuyer the value for fltRate3AverageAsBuyer 
	 * @property double $Rate4AverageAsBuyer the value for fltRate4AverageAsBuyer 
	 * @property double $Rate5AverageAsBuyer the value for fltRate5AverageAsBuyer 
	 * @property double $Rate6AverageAsBuyer the value for fltRate6AverageAsBuyer 
	 * @property double $RateAverageAsProvider the value for fltRateAverageAsProvider 
	 * @property double $Rate1AverageAsProvider the value for fltRate1AverageAsProvider 
	 * @property double $Rate2AverageAsProvider the value for fltRate2AverageAsProvider 
	 * @property double $Rate3AverageAsProvider the value for fltRate3AverageAsProvider 
	 * @property double $Rate4AverageAsProvider the value for fltRate4AverageAsProvider 
	 * @property double $Rate5AverageAsProvider the value for fltRate5AverageAsProvider 
	 * @property double $Rate6AverageAsProvider the value for fltRate6AverageAsProvider 
	 * @property integer $BudgetTotal the value for intBudgetTotal (Not Null)
	 * @property integer $PaidTotal the value for intPaidTotal (Not Null)
	 * @property integer $EarnTotal the value for intEarnTotal (Not Null)
	 * @property integer $BidTotal the value for intBidTotal (Not Null)
	 * @property integer $DaysTotal the value for intDaysTotal (Not Null)
	 * @property integer $DaysFinalTotal the value for intDaysFinalTotal (Not Null)
	 * @property double $RatioBudgetPaid the value for fltRatioBudgetPaid 
	 * @property double $RatioBidEarn the value for fltRatioBidEarn 
	 * @property double $RatioDays the value for fltRatioDays 
	 * @property QDateTime $UpdateDate the value for dttUpdateDate 
	 * @property TableUserProject $User the value for the TableUserProject object referenced by intUserId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableUserStatGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_user_stat.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.user_id
		 * @var integer intUserId
		 */
		protected $intUserId;
		const UserIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate_average_as_buyer
		 * @var double fltRateAverageAsBuyer
		 */
		protected $fltRateAverageAsBuyer;
		const RateAverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate1_average_as_buyer
		 * @var double fltRate1AverageAsBuyer
		 */
		protected $fltRate1AverageAsBuyer;
		const Rate1AverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate2_average_as_buyer
		 * @var double fltRate2AverageAsBuyer
		 */
		protected $fltRate2AverageAsBuyer;
		const Rate2AverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate3_average_as_buyer
		 * @var double fltRate3AverageAsBuyer
		 */
		protected $fltRate3AverageAsBuyer;
		const Rate3AverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate4_average_as_buyer
		 * @var double fltRate4AverageAsBuyer
		 */
		protected $fltRate4AverageAsBuyer;
		const Rate4AverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate5_average_as_buyer
		 * @var double fltRate5AverageAsBuyer
		 */
		protected $fltRate5AverageAsBuyer;
		const Rate5AverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate6_average_as_buyer
		 * @var double fltRate6AverageAsBuyer
		 */
		protected $fltRate6AverageAsBuyer;
		const Rate6AverageAsBuyerDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate_average_as_provider
		 * @var double fltRateAverageAsProvider
		 */
		protected $fltRateAverageAsProvider;
		const RateAverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate1_average_as_provider
		 * @var double fltRate1AverageAsProvider
		 */
		protected $fltRate1AverageAsProvider;
		const Rate1AverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate2_average_as_provider
		 * @var double fltRate2AverageAsProvider
		 */
		protected $fltRate2AverageAsProvider;
		const Rate2AverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate3_average_as_provider
		 * @var double fltRate3AverageAsProvider
		 */
		protected $fltRate3AverageAsProvider;
		const Rate3AverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate4_average_as_provider
		 * @var double fltRate4AverageAsProvider
		 */
		protected $fltRate4AverageAsProvider;
		const Rate4AverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate5_average_as_provider
		 * @var double fltRate5AverageAsProvider
		 */
		protected $fltRate5AverageAsProvider;
		const Rate5AverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.rate6_average_as_provider
		 * @var double fltRate6AverageAsProvider
		 */
		protected $fltRate6AverageAsProvider;
		const Rate6AverageAsProviderDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.budget_total
		 * @var integer intBudgetTotal
		 */
		protected $intBudgetTotal;
		const BudgetTotalDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.paid_total
		 * @var integer intPaidTotal
		 */
		protected $intPaidTotal;
		const PaidTotalDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.earn_total
		 * @var integer intEarnTotal
		 */
		protected $intEarnTotal;
		const EarnTotalDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.bid_total
		 * @var integer intBidTotal
		 */
		protected $intBidTotal;
		const BidTotalDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.days_total
		 * @var integer intDaysTotal
		 */
		protected $intDaysTotal;
		const DaysTotalDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.days_final_total
		 * @var integer intDaysFinalTotal
		 */
		protected $intDaysFinalTotal;
		const DaysFinalTotalDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_stat.ratio_budget_paid
		 * @var double fltRatioBudgetPaid
		 */
		protected $fltRatioBudgetPaid;
		const RatioBudgetPaidDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.ratio_bid_earn
		 * @var double fltRatioBidEarn
		 */
		protected $fltRatioBidEarn;
		const RatioBidEarnDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.ratio_days
		 * @var double fltRatioDays
		 */
		protected $fltRatioDays;
		const RatioDaysDefault = 0.00;


		/**
		 * Protected member variable that maps to the database column table_user_stat.update_date
		 * @var QDateTime dttUpdateDate
		 */
		protected $dttUpdateDate;
		const UpdateDateDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_user_stat.user_id.
		 *
		 * NOTE: Always use the User property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUser
		 */
		protected $objUser;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableUserStat from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableUserStat::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableUserStat()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableUserStats
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableUserStat::QueryArray to perform the LoadAll query
			try {
				return TableUserStat::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableUserStats
		 * @return int
		 */
		public static function CountAll() {
			// Call TableUserStat::QueryCount to perform the CountAll query
			return TableUserStat::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableUserStat::GetDatabase();

			// Create/Build out the QueryBuilder object with TableUserStat-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_user_stat');
			TableUserStat::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_user_stat');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableUserStat object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableUserStat the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserStat::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableUserStat object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableUserStat::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableUserStat::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableUserStat objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableUserStat[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserStat::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableUserStat::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableUserStat objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserStat::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableUserStat::GetDatabase();

			$strQuery = TableUserStat::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tableuserstat', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableUserStat::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableUserStat
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_user_stat';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id', $strAliasPrefix . 'user_id');
			$objBuilder->AddSelectItem($strTableName, 'rate_average_as_buyer', $strAliasPrefix . 'rate_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate1_average_as_buyer', $strAliasPrefix . 'rate1_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate2_average_as_buyer', $strAliasPrefix . 'rate2_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate3_average_as_buyer', $strAliasPrefix . 'rate3_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate4_average_as_buyer', $strAliasPrefix . 'rate4_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate5_average_as_buyer', $strAliasPrefix . 'rate5_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate6_average_as_buyer', $strAliasPrefix . 'rate6_average_as_buyer');
			$objBuilder->AddSelectItem($strTableName, 'rate_average_as_provider', $strAliasPrefix . 'rate_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'rate1_average_as_provider', $strAliasPrefix . 'rate1_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'rate2_average_as_provider', $strAliasPrefix . 'rate2_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'rate3_average_as_provider', $strAliasPrefix . 'rate3_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'rate4_average_as_provider', $strAliasPrefix . 'rate4_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'rate5_average_as_provider', $strAliasPrefix . 'rate5_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'rate6_average_as_provider', $strAliasPrefix . 'rate6_average_as_provider');
			$objBuilder->AddSelectItem($strTableName, 'budget_total', $strAliasPrefix . 'budget_total');
			$objBuilder->AddSelectItem($strTableName, 'paid_total', $strAliasPrefix . 'paid_total');
			$objBuilder->AddSelectItem($strTableName, 'earn_total', $strAliasPrefix . 'earn_total');
			$objBuilder->AddSelectItem($strTableName, 'bid_total', $strAliasPrefix . 'bid_total');
			$objBuilder->AddSelectItem($strTableName, 'days_total', $strAliasPrefix . 'days_total');
			$objBuilder->AddSelectItem($strTableName, 'days_final_total', $strAliasPrefix . 'days_final_total');
			$objBuilder->AddSelectItem($strTableName, 'ratio_budget_paid', $strAliasPrefix . 'ratio_budget_paid');
			$objBuilder->AddSelectItem($strTableName, 'ratio_bid_earn', $strAliasPrefix . 'ratio_bid_earn');
			$objBuilder->AddSelectItem($strTableName, 'ratio_days', $strAliasPrefix . 'ratio_days');
			$objBuilder->AddSelectItem($strTableName, 'update_date', $strAliasPrefix . 'update_date');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableUserStat from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableUserStat::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableUserStat
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TableUserStat object
			$objToReturn = new TableUserStat();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id'] : $strAliasPrefix . 'user_id';
			$objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate_average_as_buyer'] : $strAliasPrefix . 'rate_average_as_buyer';
			$objToReturn->fltRateAverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate1_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate1_average_as_buyer'] : $strAliasPrefix . 'rate1_average_as_buyer';
			$objToReturn->fltRate1AverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate2_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate2_average_as_buyer'] : $strAliasPrefix . 'rate2_average_as_buyer';
			$objToReturn->fltRate2AverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate3_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate3_average_as_buyer'] : $strAliasPrefix . 'rate3_average_as_buyer';
			$objToReturn->fltRate3AverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate4_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate4_average_as_buyer'] : $strAliasPrefix . 'rate4_average_as_buyer';
			$objToReturn->fltRate4AverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate5_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate5_average_as_buyer'] : $strAliasPrefix . 'rate5_average_as_buyer';
			$objToReturn->fltRate5AverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate6_average_as_buyer', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate6_average_as_buyer'] : $strAliasPrefix . 'rate6_average_as_buyer';
			$objToReturn->fltRate6AverageAsBuyer = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate_average_as_provider'] : $strAliasPrefix . 'rate_average_as_provider';
			$objToReturn->fltRateAverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate1_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate1_average_as_provider'] : $strAliasPrefix . 'rate1_average_as_provider';
			$objToReturn->fltRate1AverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate2_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate2_average_as_provider'] : $strAliasPrefix . 'rate2_average_as_provider';
			$objToReturn->fltRate2AverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate3_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate3_average_as_provider'] : $strAliasPrefix . 'rate3_average_as_provider';
			$objToReturn->fltRate3AverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate4_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate4_average_as_provider'] : $strAliasPrefix . 'rate4_average_as_provider';
			$objToReturn->fltRate4AverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate5_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate5_average_as_provider'] : $strAliasPrefix . 'rate5_average_as_provider';
			$objToReturn->fltRate5AverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'rate6_average_as_provider', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate6_average_as_provider'] : $strAliasPrefix . 'rate6_average_as_provider';
			$objToReturn->fltRate6AverageAsProvider = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'budget_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'budget_total'] : $strAliasPrefix . 'budget_total';
			$objToReturn->intBudgetTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'paid_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'paid_total'] : $strAliasPrefix . 'paid_total';
			$objToReturn->intPaidTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'earn_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'earn_total'] : $strAliasPrefix . 'earn_total';
			$objToReturn->intEarnTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'bid_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'bid_total'] : $strAliasPrefix . 'bid_total';
			$objToReturn->intBidTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'days_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'days_total'] : $strAliasPrefix . 'days_total';
			$objToReturn->intDaysTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'days_final_total', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'days_final_total'] : $strAliasPrefix . 'days_final_total';
			$objToReturn->intDaysFinalTotal = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'ratio_budget_paid', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'ratio_budget_paid'] : $strAliasPrefix . 'ratio_budget_paid';
			$objToReturn->fltRatioBudgetPaid = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'ratio_bid_earn', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'ratio_bid_earn'] : $strAliasPrefix . 'ratio_bid_earn';
			$objToReturn->fltRatioBidEarn = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'ratio_days', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'ratio_days'] : $strAliasPrefix . 'ratio_days';
			$objToReturn->fltRatioDays = $objDbRow->GetColumn($strAliasName, 'Float');
			$strAliasName = array_key_exists($strAliasPrefix . 'update_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'update_date'] : $strAliasPrefix . 'update_date';
			$objToReturn->dttUpdateDate = $objDbRow->GetColumn($strAliasName, 'DateTime');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_user_stat__';

			// Check for User Early Binding
			$strAlias = $strAliasPrefix . 'user_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUser = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableUserStats from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableUserStat[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableUserStat::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableUserStat::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableUserStat object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableUserStat::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableUserStat()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByUserId($intUserId, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByUserId query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->UserId, $intUserId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @return int
		*/
		public static function CountByUserId($intUserId) {
			// Call TableUserStat::QueryCount to perform the CountByUserId query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->UserId, $intUserId)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by RateAverageAsBuyer Index(es)
		 * @param double $fltRateAverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRateAverageAsBuyer($fltRateAverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRateAverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->RateAverageAsBuyer, $fltRateAverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by RateAverageAsBuyer Index(es)
		 * @param double $fltRateAverageAsBuyer
		 * @return int
		*/
		public static function CountByRateAverageAsBuyer($fltRateAverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRateAverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->RateAverageAsBuyer, $fltRateAverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate1AverageAsBuyer Index(es)
		 * @param double $fltRate1AverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate1AverageAsBuyer($fltRate1AverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate1AverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate1AverageAsBuyer, $fltRate1AverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate1AverageAsBuyer Index(es)
		 * @param double $fltRate1AverageAsBuyer
		 * @return int
		*/
		public static function CountByRate1AverageAsBuyer($fltRate1AverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRate1AverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate1AverageAsBuyer, $fltRate1AverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate2AverageAsBuyer Index(es)
		 * @param double $fltRate2AverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate2AverageAsBuyer($fltRate2AverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate2AverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate2AverageAsBuyer, $fltRate2AverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate2AverageAsBuyer Index(es)
		 * @param double $fltRate2AverageAsBuyer
		 * @return int
		*/
		public static function CountByRate2AverageAsBuyer($fltRate2AverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRate2AverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate2AverageAsBuyer, $fltRate2AverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate3AverageAsBuyer Index(es)
		 * @param double $fltRate3AverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate3AverageAsBuyer($fltRate3AverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate3AverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate3AverageAsBuyer, $fltRate3AverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate3AverageAsBuyer Index(es)
		 * @param double $fltRate3AverageAsBuyer
		 * @return int
		*/
		public static function CountByRate3AverageAsBuyer($fltRate3AverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRate3AverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate3AverageAsBuyer, $fltRate3AverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate4AverageAsBuyer Index(es)
		 * @param double $fltRate4AverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate4AverageAsBuyer($fltRate4AverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate4AverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate4AverageAsBuyer, $fltRate4AverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate4AverageAsBuyer Index(es)
		 * @param double $fltRate4AverageAsBuyer
		 * @return int
		*/
		public static function CountByRate4AverageAsBuyer($fltRate4AverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRate4AverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate4AverageAsBuyer, $fltRate4AverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate5AverageAsBuyer Index(es)
		 * @param double $fltRate5AverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate5AverageAsBuyer($fltRate5AverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate5AverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate5AverageAsBuyer, $fltRate5AverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate5AverageAsBuyer Index(es)
		 * @param double $fltRate5AverageAsBuyer
		 * @return int
		*/
		public static function CountByRate5AverageAsBuyer($fltRate5AverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRate5AverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate5AverageAsBuyer, $fltRate5AverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate6AverageAsBuyer Index(es)
		 * @param double $fltRate6AverageAsBuyer
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate6AverageAsBuyer($fltRate6AverageAsBuyer, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate6AverageAsBuyer query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate6AverageAsBuyer, $fltRate6AverageAsBuyer),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate6AverageAsBuyer Index(es)
		 * @param double $fltRate6AverageAsBuyer
		 * @return int
		*/
		public static function CountByRate6AverageAsBuyer($fltRate6AverageAsBuyer) {
			// Call TableUserStat::QueryCount to perform the CountByRate6AverageAsBuyer query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate6AverageAsBuyer, $fltRate6AverageAsBuyer)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by RateAverageAsProvider Index(es)
		 * @param double $fltRateAverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRateAverageAsProvider($fltRateAverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRateAverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->RateAverageAsProvider, $fltRateAverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by RateAverageAsProvider Index(es)
		 * @param double $fltRateAverageAsProvider
		 * @return int
		*/
		public static function CountByRateAverageAsProvider($fltRateAverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRateAverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->RateAverageAsProvider, $fltRateAverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate1AverageAsProvider Index(es)
		 * @param double $fltRate1AverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate1AverageAsProvider($fltRate1AverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate1AverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate1AverageAsProvider, $fltRate1AverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate1AverageAsProvider Index(es)
		 * @param double $fltRate1AverageAsProvider
		 * @return int
		*/
		public static function CountByRate1AverageAsProvider($fltRate1AverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRate1AverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate1AverageAsProvider, $fltRate1AverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate2AverageAsProvider Index(es)
		 * @param double $fltRate2AverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate2AverageAsProvider($fltRate2AverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate2AverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate2AverageAsProvider, $fltRate2AverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate2AverageAsProvider Index(es)
		 * @param double $fltRate2AverageAsProvider
		 * @return int
		*/
		public static function CountByRate2AverageAsProvider($fltRate2AverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRate2AverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate2AverageAsProvider, $fltRate2AverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate3AverageAsProvider Index(es)
		 * @param double $fltRate3AverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate3AverageAsProvider($fltRate3AverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate3AverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate3AverageAsProvider, $fltRate3AverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate3AverageAsProvider Index(es)
		 * @param double $fltRate3AverageAsProvider
		 * @return int
		*/
		public static function CountByRate3AverageAsProvider($fltRate3AverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRate3AverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate3AverageAsProvider, $fltRate3AverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate4AverageAsProvider Index(es)
		 * @param double $fltRate4AverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate4AverageAsProvider($fltRate4AverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate4AverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate4AverageAsProvider, $fltRate4AverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate4AverageAsProvider Index(es)
		 * @param double $fltRate4AverageAsProvider
		 * @return int
		*/
		public static function CountByRate4AverageAsProvider($fltRate4AverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRate4AverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate4AverageAsProvider, $fltRate4AverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate5AverageAsProvider Index(es)
		 * @param double $fltRate5AverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate5AverageAsProvider($fltRate5AverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate5AverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate5AverageAsProvider, $fltRate5AverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate5AverageAsProvider Index(es)
		 * @param double $fltRate5AverageAsProvider
		 * @return int
		*/
		public static function CountByRate5AverageAsProvider($fltRate5AverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRate5AverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate5AverageAsProvider, $fltRate5AverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by Rate6AverageAsProvider Index(es)
		 * @param double $fltRate6AverageAsProvider
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRate6AverageAsProvider($fltRate6AverageAsProvider, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRate6AverageAsProvider query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->Rate6AverageAsProvider, $fltRate6AverageAsProvider),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by Rate6AverageAsProvider Index(es)
		 * @param double $fltRate6AverageAsProvider
		 * @return int
		*/
		public static function CountByRate6AverageAsProvider($fltRate6AverageAsProvider) {
			// Call TableUserStat::QueryCount to perform the CountByRate6AverageAsProvider query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->Rate6AverageAsProvider, $fltRate6AverageAsProvider)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by BudgetTotal Index(es)
		 * @param integer $intBudgetTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByBudgetTotal($intBudgetTotal, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByBudgetTotal query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->BudgetTotal, $intBudgetTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by BudgetTotal Index(es)
		 * @param integer $intBudgetTotal
		 * @return int
		*/
		public static function CountByBudgetTotal($intBudgetTotal) {
			// Call TableUserStat::QueryCount to perform the CountByBudgetTotal query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->BudgetTotal, $intBudgetTotal)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by PaidTotal Index(es)
		 * @param integer $intPaidTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByPaidTotal($intPaidTotal, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByPaidTotal query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->PaidTotal, $intPaidTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by PaidTotal Index(es)
		 * @param integer $intPaidTotal
		 * @return int
		*/
		public static function CountByPaidTotal($intPaidTotal) {
			// Call TableUserStat::QueryCount to perform the CountByPaidTotal query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->PaidTotal, $intPaidTotal)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by EarnTotal Index(es)
		 * @param integer $intEarnTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByEarnTotal($intEarnTotal, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByEarnTotal query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->EarnTotal, $intEarnTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by EarnTotal Index(es)
		 * @param integer $intEarnTotal
		 * @return int
		*/
		public static function CountByEarnTotal($intEarnTotal) {
			// Call TableUserStat::QueryCount to perform the CountByEarnTotal query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->EarnTotal, $intEarnTotal)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by BidTotal Index(es)
		 * @param integer $intBidTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByBidTotal($intBidTotal, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByBidTotal query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->BidTotal, $intBidTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by BidTotal Index(es)
		 * @param integer $intBidTotal
		 * @return int
		*/
		public static function CountByBidTotal($intBidTotal) {
			// Call TableUserStat::QueryCount to perform the CountByBidTotal query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->BidTotal, $intBidTotal)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by DaysTotal Index(es)
		 * @param integer $intDaysTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByDaysTotal($intDaysTotal, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByDaysTotal query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->DaysTotal, $intDaysTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by DaysTotal Index(es)
		 * @param integer $intDaysTotal
		 * @return int
		*/
		public static function CountByDaysTotal($intDaysTotal) {
			// Call TableUserStat::QueryCount to perform the CountByDaysTotal query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->DaysTotal, $intDaysTotal)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by DaysFinalTotal Index(es)
		 * @param integer $intDaysFinalTotal
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByDaysFinalTotal($intDaysFinalTotal, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByDaysFinalTotal query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->DaysFinalTotal, $intDaysFinalTotal),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by DaysFinalTotal Index(es)
		 * @param integer $intDaysFinalTotal
		 * @return int
		*/
		public static function CountByDaysFinalTotal($intDaysFinalTotal) {
			// Call TableUserStat::QueryCount to perform the CountByDaysFinalTotal query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->DaysFinalTotal, $intDaysFinalTotal)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by RatioBudgetPaid Index(es)
		 * @param double $fltRatioBudgetPaid
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRatioBudgetPaid($fltRatioBudgetPaid, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRatioBudgetPaid query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->RatioBudgetPaid, $fltRatioBudgetPaid),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by RatioBudgetPaid Index(es)
		 * @param double $fltRatioBudgetPaid
		 * @return int
		*/
		public static function CountByRatioBudgetPaid($fltRatioBudgetPaid) {
			// Call TableUserStat::QueryCount to perform the CountByRatioBudgetPaid query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->RatioBudgetPaid, $fltRatioBudgetPaid)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by RatioBidEarn Index(es)
		 * @param double $fltRatioBidEarn
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRatioBidEarn($fltRatioBidEarn, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRatioBidEarn query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->RatioBidEarn, $fltRatioBidEarn),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by RatioBidEarn Index(es)
		 * @param double $fltRatioBidEarn
		 * @return int
		*/
		public static function CountByRatioBidEarn($fltRatioBidEarn) {
			// Call TableUserStat::QueryCount to perform the CountByRatioBidEarn query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->RatioBidEarn, $fltRatioBidEarn)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by RatioDays Index(es)
		 * @param double $fltRatioDays
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByRatioDays($fltRatioDays, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByRatioDays query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->RatioDays, $fltRatioDays),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by RatioDays Index(es)
		 * @param double $fltRatioDays
		 * @return int
		*/
		public static function CountByRatioDays($fltRatioDays) {
			// Call TableUserStat::QueryCount to perform the CountByRatioDays query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->RatioDays, $fltRatioDays)
			);
		}
			
		/**
		 * Load an array of TableUserStat objects,
		 * by UpdateDate Index(es)
		 * @param QDateTime $dttUpdateDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserStat[]
		*/
		public static function LoadArrayByUpdateDate($dttUpdateDate, $objOptionalClauses = null) {
			// Call TableUserStat::QueryArray to perform the LoadArrayByUpdateDate query
			try {
				return TableUserStat::QueryArray(
					QQ::Equal(QQN::TableUserStat()->UpdateDate, $dttUpdateDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserStats
		 * by UpdateDate Index(es)
		 * @param QDateTime $dttUpdateDate
		 * @return int
		*/
		public static function CountByUpdateDate($dttUpdateDate) {
			// Call TableUserStat::QueryCount to perform the CountByUpdateDate query
			return TableUserStat::QueryCount(
				QQ::Equal(QQN::TableUserStat()->UpdateDate, $dttUpdateDate)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableUserStat
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableUserStat::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_user_stat` (
							`user_id`,
							`rate_average_as_buyer`,
							`rate1_average_as_buyer`,
							`rate2_average_as_buyer`,
							`rate3_average_as_buyer`,
							`rate4_average_as_buyer`,
							`rate5_average_as_buyer`,
							`rate6_average_as_buyer`,
							`rate_average_as_provider`,
							`rate1_average_as_provider`,
							`rate2_average_as_provider`,
							`rate3_average_as_provider`,
							`rate4_average_as_provider`,
							`rate5_average_as_provider`,
							`rate6_average_as_provider`,
							`budget_total`,
							`paid_total`,
							`earn_total`,
							`bid_total`,
							`days_total`,
							`days_final_total`,
							`ratio_budget_paid`,
							`ratio_bid_earn`,
							`ratio_days`,
							`update_date`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserId) . ',
							' . $objDatabase->SqlVariable($this->fltRateAverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRate1AverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRate2AverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRate3AverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRate4AverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRate5AverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRate6AverageAsBuyer) . ',
							' . $objDatabase->SqlVariable($this->fltRateAverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->fltRate1AverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->fltRate2AverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->fltRate3AverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->fltRate4AverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->fltRate5AverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->fltRate6AverageAsProvider) . ',
							' . $objDatabase->SqlVariable($this->intBudgetTotal) . ',
							' . $objDatabase->SqlVariable($this->intPaidTotal) . ',
							' . $objDatabase->SqlVariable($this->intEarnTotal) . ',
							' . $objDatabase->SqlVariable($this->intBidTotal) . ',
							' . $objDatabase->SqlVariable($this->intDaysTotal) . ',
							' . $objDatabase->SqlVariable($this->intDaysFinalTotal) . ',
							' . $objDatabase->SqlVariable($this->fltRatioBudgetPaid) . ',
							' . $objDatabase->SqlVariable($this->fltRatioBidEarn) . ',
							' . $objDatabase->SqlVariable($this->fltRatioDays) . ',
							' . $objDatabase->SqlVariable($this->dttUpdateDate) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_user_stat', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_user_stat`
						SET
							`user_id` = ' . $objDatabase->SqlVariable($this->intUserId) . ',
							`rate_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRateAverageAsBuyer) . ',
							`rate1_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRate1AverageAsBuyer) . ',
							`rate2_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRate2AverageAsBuyer) . ',
							`rate3_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRate3AverageAsBuyer) . ',
							`rate4_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRate4AverageAsBuyer) . ',
							`rate5_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRate5AverageAsBuyer) . ',
							`rate6_average_as_buyer` = ' . $objDatabase->SqlVariable($this->fltRate6AverageAsBuyer) . ',
							`rate_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRateAverageAsProvider) . ',
							`rate1_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRate1AverageAsProvider) . ',
							`rate2_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRate2AverageAsProvider) . ',
							`rate3_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRate3AverageAsProvider) . ',
							`rate4_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRate4AverageAsProvider) . ',
							`rate5_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRate5AverageAsProvider) . ',
							`rate6_average_as_provider` = ' . $objDatabase->SqlVariable($this->fltRate6AverageAsProvider) . ',
							`budget_total` = ' . $objDatabase->SqlVariable($this->intBudgetTotal) . ',
							`paid_total` = ' . $objDatabase->SqlVariable($this->intPaidTotal) . ',
							`earn_total` = ' . $objDatabase->SqlVariable($this->intEarnTotal) . ',
							`bid_total` = ' . $objDatabase->SqlVariable($this->intBidTotal) . ',
							`days_total` = ' . $objDatabase->SqlVariable($this->intDaysTotal) . ',
							`days_final_total` = ' . $objDatabase->SqlVariable($this->intDaysFinalTotal) . ',
							`ratio_budget_paid` = ' . $objDatabase->SqlVariable($this->fltRatioBudgetPaid) . ',
							`ratio_bid_earn` = ' . $objDatabase->SqlVariable($this->fltRatioBidEarn) . ',
							`ratio_days` = ' . $objDatabase->SqlVariable($this->fltRatioDays) . ',
							`update_date` = ' . $objDatabase->SqlVariable($this->dttUpdateDate) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableUserStat
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableUserStat with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableUserStat::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_user_stat`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableUserStats
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableUserStat::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_user_stat`');
		}

		/**
		 * Truncate table_user_stat table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableUserStat::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_user_stat`');
		}

		/**
		 * Reload this TableUserStat from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableUserStat object.');

			// Reload the Object
			$objReloaded = TableUserStat::Load($this->intId);

			// Update $this's local variables to match
			$this->UserId = $objReloaded->UserId;
			$this->fltRateAverageAsBuyer = $objReloaded->fltRateAverageAsBuyer;
			$this->fltRate1AverageAsBuyer = $objReloaded->fltRate1AverageAsBuyer;
			$this->fltRate2AverageAsBuyer = $objReloaded->fltRate2AverageAsBuyer;
			$this->fltRate3AverageAsBuyer = $objReloaded->fltRate3AverageAsBuyer;
			$this->fltRate4AverageAsBuyer = $objReloaded->fltRate4AverageAsBuyer;
			$this->fltRate5AverageAsBuyer = $objReloaded->fltRate5AverageAsBuyer;
			$this->fltRate6AverageAsBuyer = $objReloaded->fltRate6AverageAsBuyer;
			$this->fltRateAverageAsProvider = $objReloaded->fltRateAverageAsProvider;
			$this->fltRate1AverageAsProvider = $objReloaded->fltRate1AverageAsProvider;
			$this->fltRate2AverageAsProvider = $objReloaded->fltRate2AverageAsProvider;
			$this->fltRate3AverageAsProvider = $objReloaded->fltRate3AverageAsProvider;
			$this->fltRate4AverageAsProvider = $objReloaded->fltRate4AverageAsProvider;
			$this->fltRate5AverageAsProvider = $objReloaded->fltRate5AverageAsProvider;
			$this->fltRate6AverageAsProvider = $objReloaded->fltRate6AverageAsProvider;
			$this->intBudgetTotal = $objReloaded->intBudgetTotal;
			$this->intPaidTotal = $objReloaded->intPaidTotal;
			$this->intEarnTotal = $objReloaded->intEarnTotal;
			$this->intBidTotal = $objReloaded->intBidTotal;
			$this->intDaysTotal = $objReloaded->intDaysTotal;
			$this->intDaysFinalTotal = $objReloaded->intDaysFinalTotal;
			$this->fltRatioBudgetPaid = $objReloaded->fltRatioBudgetPaid;
			$this->fltRatioBidEarn = $objReloaded->fltRatioBidEarn;
			$this->fltRatioDays = $objReloaded->fltRatioDays;
			$this->dttUpdateDate = $objReloaded->dttUpdateDate;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserId':
					/**
					 * Gets the value for intUserId (Not Null)
					 * @return integer
					 */
					return $this->intUserId;

				case 'RateAverageAsBuyer':
					/**
					 * Gets the value for fltRateAverageAsBuyer 
					 * @return double
					 */
					return $this->fltRateAverageAsBuyer;

				case 'Rate1AverageAsBuyer':
					/**
					 * Gets the value for fltRate1AverageAsBuyer 
					 * @return double
					 */
					return $this->fltRate1AverageAsBuyer;

				case 'Rate2AverageAsBuyer':
					/**
					 * Gets the value for fltRate2AverageAsBuyer 
					 * @return double
					 */
					return $this->fltRate2AverageAsBuyer;

				case 'Rate3AverageAsBuyer':
					/**
					 * Gets the value for fltRate3AverageAsBuyer 
					 * @return double
					 */
					return $this->fltRate3AverageAsBuyer;

				case 'Rate4AverageAsBuyer':
					/**
					 * Gets the value for fltRate4AverageAsBuyer 
					 * @return double
					 */
					return $this->fltRate4AverageAsBuyer;

				case 'Rate5AverageAsBuyer':
					/**
					 * Gets the value for fltRate5AverageAsBuyer 
					 * @return double
					 */
					return $this->fltRate5AverageAsBuyer;

				case 'Rate6AverageAsBuyer':
					/**
					 * Gets the value for fltRate6AverageAsBuyer 
					 * @return double
					 */
					return $this->fltRate6AverageAsBuyer;

				case 'RateAverageAsProvider':
					/**
					 * Gets the value for fltRateAverageAsProvider 
					 * @return double
					 */
					return $this->fltRateAverageAsProvider;

				case 'Rate1AverageAsProvider':
					/**
					 * Gets the value for fltRate1AverageAsProvider 
					 * @return double
					 */
					return $this->fltRate1AverageAsProvider;

				case 'Rate2AverageAsProvider':
					/**
					 * Gets the value for fltRate2AverageAsProvider 
					 * @return double
					 */
					return $this->fltRate2AverageAsProvider;

				case 'Rate3AverageAsProvider':
					/**
					 * Gets the value for fltRate3AverageAsProvider 
					 * @return double
					 */
					return $this->fltRate3AverageAsProvider;

				case 'Rate4AverageAsProvider':
					/**
					 * Gets the value for fltRate4AverageAsProvider 
					 * @return double
					 */
					return $this->fltRate4AverageAsProvider;

				case 'Rate5AverageAsProvider':
					/**
					 * Gets the value for fltRate5AverageAsProvider 
					 * @return double
					 */
					return $this->fltRate5AverageAsProvider;

				case 'Rate6AverageAsProvider':
					/**
					 * Gets the value for fltRate6AverageAsProvider 
					 * @return double
					 */
					return $this->fltRate6AverageAsProvider;

				case 'BudgetTotal':
					/**
					 * Gets the value for intBudgetTotal (Not Null)
					 * @return integer
					 */
					return $this->intBudgetTotal;

				case 'PaidTotal':
					/**
					 * Gets the value for intPaidTotal (Not Null)
					 * @return integer
					 */
					return $this->intPaidTotal;

				case 'EarnTotal':
					/**
					 * Gets the value for intEarnTotal (Not Null)
					 * @return integer
					 */
					return $this->intEarnTotal;

				case 'BidTotal':
					/**
					 * Gets the value for intBidTotal (Not Null)
					 * @return integer
					 */
					return $this->intBidTotal;

				case 'DaysTotal':
					/**
					 * Gets the value for intDaysTotal (Not Null)
					 * @return integer
					 */
					return $this->intDaysTotal;

				case 'DaysFinalTotal':
					/**
					 * Gets the value for intDaysFinalTotal (Not Null)
					 * @return integer
					 */
					return $this->intDaysFinalTotal;

				case 'RatioBudgetPaid':
					/**
					 * Gets the value for fltRatioBudgetPaid 
					 * @return double
					 */
					return $this->fltRatioBudgetPaid;

				case 'RatioBidEarn':
					/**
					 * Gets the value for fltRatioBidEarn 
					 * @return double
					 */
					return $this->fltRatioBidEarn;

				case 'RatioDays':
					/**
					 * Gets the value for fltRatioDays 
					 * @return double
					 */
					return $this->fltRatioDays;

				case 'UpdateDate':
					/**
					 * Gets the value for dttUpdateDate 
					 * @return QDateTime
					 */
					return $this->dttUpdateDate;


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUser) && (!is_null($this->intUserId)))
							$this->objUser = TableUserProject::Load($this->intUserId);
						return $this->objUser;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserId':
					/**
					 * Sets the value for intUserId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUser = null;
						return ($this->intUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RateAverageAsBuyer':
					/**
					 * Sets the value for fltRateAverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRateAverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate1AverageAsBuyer':
					/**
					 * Sets the value for fltRate1AverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate1AverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate2AverageAsBuyer':
					/**
					 * Sets the value for fltRate2AverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate2AverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate3AverageAsBuyer':
					/**
					 * Sets the value for fltRate3AverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate3AverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate4AverageAsBuyer':
					/**
					 * Sets the value for fltRate4AverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate4AverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate5AverageAsBuyer':
					/**
					 * Sets the value for fltRate5AverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate5AverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate6AverageAsBuyer':
					/**
					 * Sets the value for fltRate6AverageAsBuyer 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate6AverageAsBuyer = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RateAverageAsProvider':
					/**
					 * Sets the value for fltRateAverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRateAverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate1AverageAsProvider':
					/**
					 * Sets the value for fltRate1AverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate1AverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate2AverageAsProvider':
					/**
					 * Sets the value for fltRate2AverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate2AverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate3AverageAsProvider':
					/**
					 * Sets the value for fltRate3AverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate3AverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate4AverageAsProvider':
					/**
					 * Sets the value for fltRate4AverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate4AverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate5AverageAsProvider':
					/**
					 * Sets the value for fltRate5AverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate5AverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Rate6AverageAsProvider':
					/**
					 * Sets the value for fltRate6AverageAsProvider 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRate6AverageAsProvider = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'BudgetTotal':
					/**
					 * Sets the value for intBudgetTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intBudgetTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PaidTotal':
					/**
					 * Sets the value for intPaidTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPaidTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EarnTotal':
					/**
					 * Sets the value for intEarnTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intEarnTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'BidTotal':
					/**
					 * Sets the value for intBidTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intBidTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DaysTotal':
					/**
					 * Sets the value for intDaysTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDaysTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DaysFinalTotal':
					/**
					 * Sets the value for intDaysFinalTotal (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intDaysFinalTotal = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RatioBudgetPaid':
					/**
					 * Sets the value for fltRatioBudgetPaid 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRatioBudgetPaid = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RatioBidEarn':
					/**
					 * Sets the value for fltRatioBidEarn 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRatioBidEarn = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'RatioDays':
					/**
					 * Sets the value for fltRatioDays 
					 * @param double $mixValue
					 * @return double
					 */
					try {
						return ($this->fltRatioDays = QType::Cast($mixValue, QType::Float));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UpdateDate':
					/**
					 * Sets the value for dttUpdateDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttUpdateDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserId = null;
						$this->objUser = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved User for this TableUserStat');

						// Update Local Member Variables
						$this->objUser = $mixValue;
						$this->intUserId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableUserStat"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="User" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="RateAverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate1AverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate2AverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate3AverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate4AverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate5AverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate6AverageAsBuyer" type="xsd:float"/>';
			$strToReturn .= '<element name="RateAverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate1AverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate2AverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate3AverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate4AverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate5AverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="Rate6AverageAsProvider" type="xsd:float"/>';
			$strToReturn .= '<element name="BudgetTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="PaidTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="EarnTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="BidTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="DaysTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="DaysFinalTotal" type="xsd:int"/>';
			$strToReturn .= '<element name="RatioBudgetPaid" type="xsd:float"/>';
			$strToReturn .= '<element name="RatioBidEarn" type="xsd:float"/>';
			$strToReturn .= '<element name="RatioDays" type="xsd:float"/>';
			$strToReturn .= '<element name="UpdateDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableUserStat', $strComplexTypeArray)) {
				$strComplexTypeArray['TableUserStat'] = TableUserStat::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableUserStat::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableUserStat();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if ((property_exists($objSoapObject, 'User')) &&
				($objSoapObject->User))
				$objToReturn->User = TableUserProject::GetObjectFromSoapObject($objSoapObject->User);
			if (property_exists($objSoapObject, 'RateAverageAsBuyer'))
				$objToReturn->fltRateAverageAsBuyer = $objSoapObject->RateAverageAsBuyer;
			if (property_exists($objSoapObject, 'Rate1AverageAsBuyer'))
				$objToReturn->fltRate1AverageAsBuyer = $objSoapObject->Rate1AverageAsBuyer;
			if (property_exists($objSoapObject, 'Rate2AverageAsBuyer'))
				$objToReturn->fltRate2AverageAsBuyer = $objSoapObject->Rate2AverageAsBuyer;
			if (property_exists($objSoapObject, 'Rate3AverageAsBuyer'))
				$objToReturn->fltRate3AverageAsBuyer = $objSoapObject->Rate3AverageAsBuyer;
			if (property_exists($objSoapObject, 'Rate4AverageAsBuyer'))
				$objToReturn->fltRate4AverageAsBuyer = $objSoapObject->Rate4AverageAsBuyer;
			if (property_exists($objSoapObject, 'Rate5AverageAsBuyer'))
				$objToReturn->fltRate5AverageAsBuyer = $objSoapObject->Rate5AverageAsBuyer;
			if (property_exists($objSoapObject, 'Rate6AverageAsBuyer'))
				$objToReturn->fltRate6AverageAsBuyer = $objSoapObject->Rate6AverageAsBuyer;
			if (property_exists($objSoapObject, 'RateAverageAsProvider'))
				$objToReturn->fltRateAverageAsProvider = $objSoapObject->RateAverageAsProvider;
			if (property_exists($objSoapObject, 'Rate1AverageAsProvider'))
				$objToReturn->fltRate1AverageAsProvider = $objSoapObject->Rate1AverageAsProvider;
			if (property_exists($objSoapObject, 'Rate2AverageAsProvider'))
				$objToReturn->fltRate2AverageAsProvider = $objSoapObject->Rate2AverageAsProvider;
			if (property_exists($objSoapObject, 'Rate3AverageAsProvider'))
				$objToReturn->fltRate3AverageAsProvider = $objSoapObject->Rate3AverageAsProvider;
			if (property_exists($objSoapObject, 'Rate4AverageAsProvider'))
				$objToReturn->fltRate4AverageAsProvider = $objSoapObject->Rate4AverageAsProvider;
			if (property_exists($objSoapObject, 'Rate5AverageAsProvider'))
				$objToReturn->fltRate5AverageAsProvider = $objSoapObject->Rate5AverageAsProvider;
			if (property_exists($objSoapObject, 'Rate6AverageAsProvider'))
				$objToReturn->fltRate6AverageAsProvider = $objSoapObject->Rate6AverageAsProvider;
			if (property_exists($objSoapObject, 'BudgetTotal'))
				$objToReturn->intBudgetTotal = $objSoapObject->BudgetTotal;
			if (property_exists($objSoapObject, 'PaidTotal'))
				$objToReturn->intPaidTotal = $objSoapObject->PaidTotal;
			if (property_exists($objSoapObject, 'EarnTotal'))
				$objToReturn->intEarnTotal = $objSoapObject->EarnTotal;
			if (property_exists($objSoapObject, 'BidTotal'))
				$objToReturn->intBidTotal = $objSoapObject->BidTotal;
			if (property_exists($objSoapObject, 'DaysTotal'))
				$objToReturn->intDaysTotal = $objSoapObject->DaysTotal;
			if (property_exists($objSoapObject, 'DaysFinalTotal'))
				$objToReturn->intDaysFinalTotal = $objSoapObject->DaysFinalTotal;
			if (property_exists($objSoapObject, 'RatioBudgetPaid'))
				$objToReturn->fltRatioBudgetPaid = $objSoapObject->RatioBudgetPaid;
			if (property_exists($objSoapObject, 'RatioBidEarn'))
				$objToReturn->fltRatioBidEarn = $objSoapObject->RatioBidEarn;
			if (property_exists($objSoapObject, 'RatioDays'))
				$objToReturn->fltRatioDays = $objSoapObject->RatioDays;
			if (property_exists($objSoapObject, 'UpdateDate'))
				$objToReturn->dttUpdateDate = new QDateTime($objSoapObject->UpdateDate);
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableUserStat::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objUser)
				$objObject->objUser = TableUserProject::GetSoapObjectFromObject($objObject->objUser, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserId = null;
			if ($objObject->dttUpdateDate)
				$objObject->dttUpdateDate = $objObject->dttUpdateDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableUserStat extends QQNode {
		protected $strTableName = 'table_user_stat';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableUserStat';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'RateAverageAsBuyer':
					return new QQNode('rate_average_as_buyer', 'RateAverageAsBuyer', 'double', $this);
				case 'Rate1AverageAsBuyer':
					return new QQNode('rate1_average_as_buyer', 'Rate1AverageAsBuyer', 'double', $this);
				case 'Rate2AverageAsBuyer':
					return new QQNode('rate2_average_as_buyer', 'Rate2AverageAsBuyer', 'double', $this);
				case 'Rate3AverageAsBuyer':
					return new QQNode('rate3_average_as_buyer', 'Rate3AverageAsBuyer', 'double', $this);
				case 'Rate4AverageAsBuyer':
					return new QQNode('rate4_average_as_buyer', 'Rate4AverageAsBuyer', 'double', $this);
				case 'Rate5AverageAsBuyer':
					return new QQNode('rate5_average_as_buyer', 'Rate5AverageAsBuyer', 'double', $this);
				case 'Rate6AverageAsBuyer':
					return new QQNode('rate6_average_as_buyer', 'Rate6AverageAsBuyer', 'double', $this);
				case 'RateAverageAsProvider':
					return new QQNode('rate_average_as_provider', 'RateAverageAsProvider', 'double', $this);
				case 'Rate1AverageAsProvider':
					return new QQNode('rate1_average_as_provider', 'Rate1AverageAsProvider', 'double', $this);
				case 'Rate2AverageAsProvider':
					return new QQNode('rate2_average_as_provider', 'Rate2AverageAsProvider', 'double', $this);
				case 'Rate3AverageAsProvider':
					return new QQNode('rate3_average_as_provider', 'Rate3AverageAsProvider', 'double', $this);
				case 'Rate4AverageAsProvider':
					return new QQNode('rate4_average_as_provider', 'Rate4AverageAsProvider', 'double', $this);
				case 'Rate5AverageAsProvider':
					return new QQNode('rate5_average_as_provider', 'Rate5AverageAsProvider', 'double', $this);
				case 'Rate6AverageAsProvider':
					return new QQNode('rate6_average_as_provider', 'Rate6AverageAsProvider', 'double', $this);
				case 'BudgetTotal':
					return new QQNode('budget_total', 'BudgetTotal', 'integer', $this);
				case 'PaidTotal':
					return new QQNode('paid_total', 'PaidTotal', 'integer', $this);
				case 'EarnTotal':
					return new QQNode('earn_total', 'EarnTotal', 'integer', $this);
				case 'BidTotal':
					return new QQNode('bid_total', 'BidTotal', 'integer', $this);
				case 'DaysTotal':
					return new QQNode('days_total', 'DaysTotal', 'integer', $this);
				case 'DaysFinalTotal':
					return new QQNode('days_final_total', 'DaysFinalTotal', 'integer', $this);
				case 'RatioBudgetPaid':
					return new QQNode('ratio_budget_paid', 'RatioBudgetPaid', 'double', $this);
				case 'RatioBidEarn':
					return new QQNode('ratio_bid_earn', 'RatioBidEarn', 'double', $this);
				case 'RatioDays':
					return new QQNode('ratio_days', 'RatioDays', 'double', $this);
				case 'UpdateDate':
					return new QQNode('update_date', 'UpdateDate', 'QDateTime', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableUserStat extends QQReverseReferenceNode {
		protected $strTableName = 'table_user_stat';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableUserStat';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'RateAverageAsBuyer':
					return new QQNode('rate_average_as_buyer', 'RateAverageAsBuyer', 'double', $this);
				case 'Rate1AverageAsBuyer':
					return new QQNode('rate1_average_as_buyer', 'Rate1AverageAsBuyer', 'double', $this);
				case 'Rate2AverageAsBuyer':
					return new QQNode('rate2_average_as_buyer', 'Rate2AverageAsBuyer', 'double', $this);
				case 'Rate3AverageAsBuyer':
					return new QQNode('rate3_average_as_buyer', 'Rate3AverageAsBuyer', 'double', $this);
				case 'Rate4AverageAsBuyer':
					return new QQNode('rate4_average_as_buyer', 'Rate4AverageAsBuyer', 'double', $this);
				case 'Rate5AverageAsBuyer':
					return new QQNode('rate5_average_as_buyer', 'Rate5AverageAsBuyer', 'double', $this);
				case 'Rate6AverageAsBuyer':
					return new QQNode('rate6_average_as_buyer', 'Rate6AverageAsBuyer', 'double', $this);
				case 'RateAverageAsProvider':
					return new QQNode('rate_average_as_provider', 'RateAverageAsProvider', 'double', $this);
				case 'Rate1AverageAsProvider':
					return new QQNode('rate1_average_as_provider', 'Rate1AverageAsProvider', 'double', $this);
				case 'Rate2AverageAsProvider':
					return new QQNode('rate2_average_as_provider', 'Rate2AverageAsProvider', 'double', $this);
				case 'Rate3AverageAsProvider':
					return new QQNode('rate3_average_as_provider', 'Rate3AverageAsProvider', 'double', $this);
				case 'Rate4AverageAsProvider':
					return new QQNode('rate4_average_as_provider', 'Rate4AverageAsProvider', 'double', $this);
				case 'Rate5AverageAsProvider':
					return new QQNode('rate5_average_as_provider', 'Rate5AverageAsProvider', 'double', $this);
				case 'Rate6AverageAsProvider':
					return new QQNode('rate6_average_as_provider', 'Rate6AverageAsProvider', 'double', $this);
				case 'BudgetTotal':
					return new QQNode('budget_total', 'BudgetTotal', 'integer', $this);
				case 'PaidTotal':
					return new QQNode('paid_total', 'PaidTotal', 'integer', $this);
				case 'EarnTotal':
					return new QQNode('earn_total', 'EarnTotal', 'integer', $this);
				case 'BidTotal':
					return new QQNode('bid_total', 'BidTotal', 'integer', $this);
				case 'DaysTotal':
					return new QQNode('days_total', 'DaysTotal', 'integer', $this);
				case 'DaysFinalTotal':
					return new QQNode('days_final_total', 'DaysFinalTotal', 'integer', $this);
				case 'RatioBudgetPaid':
					return new QQNode('ratio_budget_paid', 'RatioBudgetPaid', 'double', $this);
				case 'RatioBidEarn':
					return new QQNode('ratio_bid_earn', 'RatioBidEarn', 'double', $this);
				case 'RatioDays':
					return new QQNode('ratio_days', 'RatioDays', 'double', $this);
				case 'UpdateDate':
					return new QQNode('update_date', 'UpdateDate', 'QDateTime', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>